<?php
class My_View_Helper_NombreDC extends Zend_View_Helper_Abstract
 {

        private $nombreCache='zonas';
        private $lifetime=7200;//2 horas
        private $automatic_serialization=true;
        private $cache_dir='tmp/';
        

        public function nombreDC($idZona)
        {

            //cache
            $frontendOptions = array('lifetime' => $this->lifetime,'automatic_serialization' => $this->automatic_serialization);
            $backendOptions = array('cache_dir' => $this->cache_dir);
            $cache = Zend_Cache::factory('Core','File',$frontendOptions,$backendOptions);
         


            if( ($result = $cache->load($this->nombreCache)) === false ) {
                $db= Zend_Db_Table::getDefaultAdapter();
                $select = $db->select();
			    $select->from( array($this->nombreCache), array( 'id', 'nombre' ) );
			    $result = $db->fetchPairs( $select );
                $cache->save($result,$this->nombreCache);
            } 
            
            return $result[$idZona];
  
        }   
}